#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#define OLED_RESET     4
Adafruit_SSD1306 display(128, 64, &Wire);

const char* AP_ssid ="电梯外呼板";//要创建的热点名
const char* AP_password ="12345678";//创建的热点密码
ESP8266WebServer server(80);
String html="<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><title>&#x7535;&#x68AF;&#x5916;&#x547C;&#x677F;&#x63A7;&#x5236;</title></head><body><a href=\"./pin?floor=1\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"1&#x697C;\"></a><a href=\"./pin?floor=2\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"2&#x697C;\"></a><a href=\"./pin?floor=3\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"3&#x697C;\"></a><a href=\"./pin?floor=4\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"4&#x697C;\"></a><a href=\"./pin?floor=5\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"5&#x697C;\"></a><a href=\"./pin?floor=6\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"6&#x697C;\"></a><a href=\"./pin?floor=7\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"7&#x697C;\"></a><a href=\"./pin?floor=8\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"8&#x697C;\"></a><a href=\"./pin?floor=9\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"9&#x697C;\"></a><a href=\"./pin?floor=10\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"10&#x697C;\"></a><a href=\"./pin?floor=11\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"11&#x697C;\"></a><a href=\"./pin?floor=12\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"12&#x697C;\"></a><a href=\"./pin?floor=13\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"13&#x697C;\"></a><a href=\"./pin?floor=14\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"14&#x697C;\"></a><a href=\"./pin?floor=15\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"15&#x697C;\"></a><a href=\"./pin?floor=16\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"16&#x697C;\"></a><a href=\"./pin?floor=17\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"17&#x697C;\"></a><a href=\"./pin?floor=18\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"18&#x697C;\"></a><a href=\"./pin?floor=19\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"19&#x697C;\"></a><a href=\"./pin?floor=20\"><input type=\"button\"style=\"width: 100px;height: 100px;font-size:50px;\"value=\"20&#x697C;\"></a></body></html>";
static const unsigned char PROGMEM up[] =  
{0x00,0x03,0xC0,0x00,0x00,0x07,0xE0,0x00,0x00,0x0F,0xF0,0x00,0x00,0x1F,0xF8,0x00,
0x00,0x3F,0xFC,0x00,0x00,0x7B,0xDE,0x00,0x00,0xF3,0xCF,0x00,0x01,0xE3,0xC7,0x80,
0x03,0xC3,0xC3,0xC0,0x07,0x83,0xC1,0xE0,0x0F,0x03,0xC0,0xF0,0x0E,0x03,0xC0,0x70,
0x0C,0x03,0xC0,0x30,0x08,0x03,0xC0,0x10,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00};
static const unsigned char PROGMEM down[] = 
{0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x08,0x03,0xC0,0x10,0x0C,0x03,0xC0,0x30,
0x0E,0x03,0xC0,0x70,0x0F,0x03,0xC0,0xF0,0x07,0x83,0xC1,0xE0,0x03,0xC3,0xC3,0xC0,
0x01,0xE3,0xC7,0x80,0x00,0xF3,0xCF,0x00,0x00,0x7B,0xDE,0x00,0x00,0x3F,0xFC,0x00,
0x00,0x1F,0xF8,0x00,0x00,0x0F,0xF0,0x00,0x00,0x07,0xE0,0x00,0x00,0x03,0xC0,0x00};
static const unsigned char PROGMEM str1[] = 
{0x00,0x03,0xC0,0x00,0x00,0x07,0xC0,0x00,0x00,0x0F,0xC0,0x00,0x00,0x1F,0xC0,0x00,
0x00,0x3F,0xC0,0x00,0x00,0x7B,0xC0,0x00,0x00,0x73,0xC0,0x00,0x00,0x63,0xC0,0x00,
0x00,0x63,0xC0,0x00,0x00,0x43,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00};
static const unsigned char PROGMEM str2[] = 
{0x00,0x07,0xF8,0x00,0x00,0x0F,0xFC,0x00,0x00,0x1F,0xFE,0x00,0x00,0x3E,0x0F,0x00,
0x00,0x7C,0x07,0x80,0x00,0xF0,0x03,0x80,0x00,0xE0,0x03,0x80,0x00,0xC0,0x03,0x80,
0x00,0x80,0x03,0x80,0x00,0x00,0x03,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x0F,0x00,
0x00,0x00,0x1E,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xF0,0x00,
0x00,0x01,0xE0,0x00,0x00,0x03,0xC0,0x00,0x00,0x07,0x80,0x00,0x00,0x0F,0x00,0x00,
0x00,0x1E,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xF0,0x00,0x00,
0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,
0x00,0xE0,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00};
static const unsigned char PROGMEM str3[] = {
0x00,0x07,0xF8,0x00,0x00,0x0F,0xFC,0x00,0x00,0x1F,0xFE,0x00,0x00,0x3E,0x0F,0x00,
0x00,0x7C,0x07,0x80,0x00,0xF0,0x03,0x80,0x00,0xE0,0x03,0x80,0x00,0xC0,0x03,0x80,
0x00,0x80,0x03,0x80,0x00,0x00,0x03,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x0F,0x00,
0x00,0x00,0x1E,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xF0,0x00,
0x00,0x01,0xF0,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x3E,0x00,
0x00,0x00,0x1F,0x00,0x00,0x00,0x0F,0x80,0x00,0x00,0x07,0x80,0x00,0x80,0x03,0x80,
0x00,0xC0,0x03,0x80,0x00,0xE0,0x03,0x80,0x00,0xF0,0x07,0x80,0x00,0x78,0x0F,0x00,
0x00,0x3F,0xFE,0x00,0x00,0x1F,0xFC,0x00,0x00,0x0F,0xF8,0x00,0x00,0x07,0xF0,0x00
};
static const unsigned char PROGMEM str4[] = {
  0x00,0x00,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
0x00,0x07,0xE0,0x00,0x00,0x0F,0xE0,0x00,0x00,0x0F,0xE0,0x00,0x00,0x1E,0xE0,0x00,
0x00,0x1C,0xE0,0x00,0x00,0x3C,0xE0,0x00,0x00,0x38,0xE0,0x00,0x00,0x78,0xE0,0x00,
0x00,0xF0,0xE0,0x00,0x00,0xF0,0xE0,0x00,0x01,0xE0,0xE0,0x00,0x03,0xE0,0xE0,0x00,
0x03,0xC0,0xE0,0x00,0x03,0xC0,0xE0,0x00,0x03,0xFF,0xFF,0x00,0x03,0xFF,0xFF,0x00,
0x03,0xFF,0xFF,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,
0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,
0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00
};
static const unsigned char PROGMEM str5[] = {
  0x00,0xFF,0xFE,0x00,0x00,0xFF,0xFE,0x00,0x00,0xFF,0xFE,0x00,0x00,0xFF,0xFE,0x00,
0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,
0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,
0x00,0xEF,0xF8,0x00,0x00,0xFF,0xFE,0x00,0x00,0xFF,0xFE,0x00,0x00,0xFF,0xFE,0x00,
0x00,0xF0,0x1E,0x00,0x00,0xE0,0x0E,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,
0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,
0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x3E,0x00,
0x00,0xFF,0xFE,0x00,0x00,0xFF,0xFC,0x00,0x00,0xFF,0xF8,0x00,0x00,0xFF,0xF0,0x00
};
static const unsigned char PROGMEM str6[] = {
  0x00,0x3F,0xFE,0x00,0x00,0x7F,0xFE,0x00,0x00,0xFF,0xFE,0x00,0x00,0xFF,0xFE,0x00,
0x00,0xF0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,
0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xE0,0x00,0x00,
0x00,0xEF,0xF8,0x00,0x00,0xFF,0xFC,0x00,0x00,0xFF,0xFE,0x00,0x00,0xFF,0xFE,0x00,
0x00,0xF0,0x1E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xF0,0x1E,0x00,0x00,0xF8,0x3E,0x00,
0x00,0xFF,0xFE,0x00,0x00,0x7F,0xFC,0x00,0x00,0x3F,0xF8,0x00,0x00,0x1F,0xF0,0x00
};
static const unsigned char PROGMEM str7[] = {
0x00,0x7F,0xFF,0x00,0x00,0x7F,0xFF,0x00,0x00,0x7F,0xFF,0x00,0x00,0x7F,0xFF,0x00,
0x00,0x00,0x07,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0C,0x00,
0x00,0x00,0x1C,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,
0x00,0x00,0x78,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0xE0,0x00,
0x00,0x01,0xE0,0x00,0x00,0x01,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0x80,0x00,
0x00,0x07,0x80,0x00,0x00,0x07,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0E,0x00,0x00,
0x00,0x1E,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,
0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x70,0x00,0x00
};
static const unsigned char PROGMEM str8[] = {
0x00,0x1F,0xF0,0x00,0x00,0x3F,0xF8,0x00,0x00,0x7F,0xFC,0x00,0x00,0xFF,0xFE,0x00,
0x00,0xF8,0x3E,0x00,0x00,0xF0,0x1E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xF0,0x1E,0x00,0x00,0xF8,0x3E,0x00,0x00,0x7F,0xFC,0x00,0x00,0x3F,0xF8,0x00,
0x00,0x7F,0xFC,0x00,0x00,0xFF,0xFE,0x00,0x00,0xF8,0x3E,0x00,0x00,0xF0,0x1E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xF0,0x1E,0x00,0x00,0xF8,0x3E,0x00,
0x00,0xFF,0xFE,0x00,0x00,0x7F,0xFC,0x00,0x00,0x3F,0xF8,0x00,0x00,0x1F,0xF0,0x00
};
static const unsigned char PROGMEM str9[] = {
0x00,0x1F,0xF0,0x00,0x00,0x3F,0xF8,0x00,0x00,0x7F,0xFC,0x00,0x00,0xFF,0xFE,0x00,
0x00,0xF8,0x3E,0x00,0x00,0xF0,0x1E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xF0,0x1E,0x00,0x00,0xF8,0x3E,0x00,0x00,0xFF,0xFE,0x00,0x00,0x7F,0xFE,0x00,
0x00,0x3F,0xEE,0x00,0x00,0x0F,0xCE,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,
0x00,0x00,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xF0,0x1E,0x00,0x00,0xF8,0x3E,0x00,
0x00,0xFF,0xFE,0x00,0x00,0x7F,0xFC,0x00,0x00,0x3F,0xF8,0x00,0x00,0x1F,0xF0,0x00
};
static const unsigned char PROGMEM str0[] = {
  0x00,0x1F,0xF0,0x00,0x00,0x3F,0xF8,0x00,0x00,0x7F,0xFC,0x00,0x00,0xFF,0xFE,0x00,
0x00,0xF8,0x3E,0x00,0x00,0xF0,0x1E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,
0x00,0xE0,0x0E,0x00,0x00,0xE0,0x0E,0x00,0x00,0xF0,0x1E,0x00,0x00,0xF8,0x3E,0x00,
0x00,0xFF,0xFE,0x00,0x00,0x7F,0xFC,0x00,0x00,0x3F,0xF8,0x00,0x00,0x1F,0xF0,0x00
};
void pin(){
  if(server.arg("floor")=="1"){
    atob(1);
    server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="2"){
    atob(2);
    server.send(200, "text/html", html);
      
   }
   else if(server.arg("floor")=="3"){
      atob(3);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="4"){
      atob(4);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="5"){
      atob(5);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="6"){
      atob(6);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="7"){
      atob(7);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="8"){
      atob(8);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="9"){
      atob(9);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="10"){
      atob(10);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="11"){
      atob(11);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="12"){
      atob(12);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="13"){
      atob(13);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="14"){
      atob(14);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="15"){
      atob(15);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="16"){
      atob(16);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="17"){
      atob(17);
      server.send(200, "text/html", html);
    }
    else if(server.arg("floor")=="18"){
      atob(18);
      server.send(200, "text/html", html);
    }
     else if(server.arg("floor")=="19"){
      atob(19);
      server.send(200, "text/html", html);
    }
     else if(server.arg("floor")=="20"){
      atob(20);
      server.send(200, "text/html", html);
    }
    
}
void handleRoot() {
  server.send(200, "text/html", html);
}
void handleNotFound(){
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}
int a = 1;
int b = 1;
void setup() {
 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
 display.setTextColor(WHITE);//开像素点发光
 display.clearDisplay();//清屏
 show(a,0);
    //网页初始化
    server.on("/", handleRoot);
    server.on("/pin", HTTP_GET, pin);
    server.on("/inline", [](){
    server.send(200, "text/plain", "this works as well");
    });
    server.onNotFound(handleNotFound);
    server.begin();
    //Serial.println("HTTP server started");
     WiFi.begin();
     
    Serial.println();
    //Serial.print("Setting soft-AP ... ");
      //ap初始化 
    IPAddress softLocal(192,168,1,1);  //这里
    IPAddress softGateway(192,168,1,1);//和这里，修改创建热点的接入IP
    IPAddress softSubnet(255,255,255,0);
    WiFi.softAPConfig(softLocal, softGateway, softSubnet);  
    WiFi.softAP(AP_ssid, AP_password);
       
    IPAddress myIP = WiFi.softAPIP();
    Serial.print("AP IP address: ");
    Serial.println(myIP);
    //atob(10);
 
}

void loop() {
  server.handleClient();
}

void atob(int b){
//  display.drawBitmap(0, 16, up, 32, 32, 1); //画出字符对应点阵数据
//  display.drawBitmap(64, 16, str1, 32, 32, 1);
//  display.drawBitmap(80, 16, a, 32, 32, 1);
//  display.display();
//  delay(1000);
//  display.clearDisplay();
//  display.drawBitmap(0, 16, up, 32, 32, 1); //画出字符对应点阵数据
//  display.drawBitmap(64, 16, str1, 32, 32, 1);
//  display.drawBitmap(80, 16, b, 32, 32, 1);
//  display.display();
//  delay(1000);
//  display.clearDisplay();
    while(a<b){
      show(a,1);
      a++;
    }
    while(a>b){
      show(a,2);
      a--;
    }
     show(a,0); 
}

void show(int a,int b){
  display.clearDisplay();
  if(b){
    showud(b);
  }
  if(a==1){
    display.drawBitmap(72, 16, str1, 32, 32, 1);
  }
  if(a==2){
    display.drawBitmap(72, 16, str2, 32, 32, 1);
  }
  if(a==3){
    display.drawBitmap(72, 16, str3, 32, 32, 1);
  }
  if(a==4){
    display.drawBitmap(72, 16, str4, 32, 32, 1);
  }
  if(a==5){
    display.drawBitmap(72, 16, str5, 32, 32, 1);
  }
  if(a==6){
    display.drawBitmap(72, 16, str6, 32, 32, 1);
  }
  if(a==7){
    display.drawBitmap(72, 16, str7, 32, 32, 1);
  }
  if(a==8){
    display.drawBitmap(72, 16, str8, 32, 32, 1);
  }
  if(a==9){
    display.drawBitmap(72, 16, str9, 32, 32, 1);
  }
  if(a==10){
    display.drawBitmap(64, 16, str1, 32, 32, 1);
    display.drawBitmap(80, 16, str0, 32, 32, 1);
  }
  if(a==11){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
    display.drawBitmap(80, 16, str1, 32, 32, 1);
  }
  if(a==12){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
     display.drawBitmap(80, 16, str2, 32, 32, 1);
  }
  if(a==13){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
     display.drawBitmap(80, 16, str3, 32, 32, 1);
  }
  if(a==14){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
     display.drawBitmap(80, 16, str4, 32, 32, 1);
  }
  if(a==15){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
     display.drawBitmap(80, 16, str5, 32, 32, 1);
  }
  if(a==16){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
     display.drawBitmap(80, 16, str6, 32, 32, 1);
  }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  if(a==17){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
     display.drawBitmap(80, 16, str7, 32, 32, 1);
  }
  if(a==18){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
     display.drawBitmap(80, 16, str8, 32, 32, 1);
  }
  if(a==19){
     display.drawBitmap(64, 16, str1, 32, 32, 1);
     display.drawBitmap(80, 16, str9, 32, 32, 1);
  }
  if(a==20){
     display.drawBitmap(64, 16, str2, 32, 32, 1);
     display.drawBitmap(80, 16, str0, 32, 32, 1);
  }
  display.display();
  delay(2000);
}

void showud(int a){
  if(a==1){
    display.drawBitmap(0, 16, up, 32, 32, 1); //画出字符对应点阵数据
  }
  if(a==2){
    display.drawBitmap(0, 16, down, 32, 32, 1);
  }
}

